package com.erps.db;


public class DBType {
	public final static int MYSQL = 1;
	public final static int POSTGRE = 2;
	public final static int MSSQL = 3;
	public final static int ORACLE = 4;
	public final static String SLAVE = "SlaveDB";
	public final static String MASTER = "MasterDB";
	public static final String DW = "hmdw.";

	public static int getDBType() {
		return getDBType(MASTER);
	}

	public static int getDBType(String cKeyID) {
		String cDBDriver = "";
		try {
			MDBConfig cfg = MDBConfig.readConfig(MASTER);
			cDBDriver = cfg.getDBDriver();
		} catch (Exception ex) {
			cDBDriver = "";
		}
		if (cDBDriver.indexOf("mysql") > 0) {
			return DBType.MYSQL;
		} else if (cDBDriver.indexOf("sqlserver") > 0) {
			return DBType.MSSQL;
		} else if (cDBDriver.indexOf("postgre") > 0) {
			return DBType.POSTGRE;
		} else if (cDBDriver.indexOf("oracle") > 0) {
			return DBType.ORACLE;
		} else {
			return DBType.MYSQL;
		}
	}
}
